home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Sample Code / Devices / Load PCI Driver / SimpleApp / SimpleAppIntf.p < prev    next >
Encoding:
Text File  |  1997-07-10  |  8.7 KB  |  183 lines  |  [TEXT/CWIE]

  1. (*************************************************************************
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    SimpleApp Framework: A Copland Savvy Application Framework.
  5. **
  6. **    by Matthew Xavier Mora, Apple Developer Technical Support
  7. **
  8. **    File:        SimpleAppIntf.p
  9. **
  10. **    Copyright © 1995-1996 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. **
  21. **************************************************************************)
  22.  
  23.  
  24. unit SimpleAppIntf;
  25. interface
  26.  
  27.     uses
  28.         GestaltEqu, ToolUtils,Fonts,Lists, DiskInit, Devices,AppleScript,
  29.         SimpleAppGlobals,Resources, palettes;
  30.  
  31. const
  32.  
  33.     kErrorBase                            = 0 ;     {    Base value for ErrorNumbers}
  34.     kSAStandardDebugAlert     = 9999;
  35.     kSANonFatalError                 = 0;
  36.     kSAFatalError                     = kErrorBase - 1 ;
  37.     kSABadSelectorErr                = kErrorBase - 2 ;
  38.     kSABadProcPtr                        = kErrorBase - 3 ;    
  39.     kNotOurWindowError             = kErrorBase - 4 ;    
  40.     kNotValidObject                    = kErrorBase - 5 ;
  41.  
  42.     function     SALockHandle (hand: univ Ptr): SInt8;
  43.     procedure SAUnlockHandle (hand: univ Ptr; state: SInt8);
  44.     function     GetDialogWindow (resID: integer;ditlResID:integer): integer;
  45.     function    SAExecuteScript(resID:integer):integer;
  46.     procedure ErrorMessage(msg:Str255;error:longint;flags:integer);
  47.     procedure SAMoveObject (orh:ObjectRef;h,v:integer;reDraw:Boolean);
  48.     procedure SADrawGroup(    grh:GroupRecHandle;update:RgnHandle);
  49.     procedure InitSimpleApp (masters: integer; wantsStandardMenu: Boolean);
  50.     procedure InitFBSimpleApp (masters: integer; stackSize: longint);
  51.     procedure SAInitCursor;
  52.     procedure InstallAboutProc(ap:AboutProc);
  53.     procedure Run;
  54.     procedure CloseSimpleApp;    
  55.     procedure SADoWindowClose(var theWindow:WindowRef);
  56.     function     DefaultMenuHit (modifiers: longint): integer;
  57.  
  58.     function     InstallMenuItem (menuID: integer;MenuItem: integer;var menuTitle: Str255;mark: UInt8;cmdUInt8: UInt8;menuHit: MenuHitProc; menuUpdate: MenuUpdateProc): integer;
  59.     function     InstallEditField (var editID : longint; window    : WindowRef ; var name : Str255 ; var r: Rect ; hitProc:EditFieldHitProc ; updateProc: EditFieldUpdateProc ; keyProc : ObjectKeyProc;flags            : longint): integer;
  60. function InstallList (var theListID: longint; window: WindowRef; cellSize:Point; var r: Rect;{}
  61.                         lhp: ListHitProc; ltp: ListTrackProc; lup: ListUpdateProc; ldcp: ListDrawCellProc; flags: longint): integer;
  62.     procedure InstallIdleProc (ip: EventProcs);
  63.     function     InstallPushButton (var buttonID: longint; window: WindowRef;var name: Str255;var r: Rect;cmdKey: UInt8;bhp: ButtonHitProc;bup: ButtonUpdateProc): integer;
  64.     function     InstallCheckBox(var buttonID: longint;window: WindowRef;var  name: Str255;var r: Rect;cmdKey: UInt8;initialValue:integer;bhp: ButtonHitProc;bup: ButtonUpdateProc ): integer;
  65.     function     InstallPopUp(var buttonID: longint;window: WindowRef;var  name: Str255;var r: Rect;options,styles:integer;MenuID:integer;resID:OSType;bhp: ButtonHitProc;bup: ButtonUpdateProc ): integer;
  66.             
  67.     procedure SAInitScripting;
  68.     function     SADoNew:OSErr;
  69.     
  70.     function     CreateDocumentWindow (var name: Str255; var bounds: Rect; visable: Boolean): integer;
  71.     function     GetDocumentWindow (resID: integer): integer;
  72.  
  73.     procedure Print (s: Str255);                   {Print no CR}
  74.     procedure PrintLine (s: Str255);                {Print with CR}
  75.     procedure PrintTextHandle (text: Handle);     {Print a buffer full of text with CR}
  76.  
  77.     procedure SetRectLocation (var r: Rect; h, v: integer);            {This Sets a rects anchor point}
  78.     procedure SetRectDimensions (var r: Rect; h, v: integer);            {This Sets its size without changing its position}
  79.  
  80.     procedure GetPrintArea (window: WindowRef; var bounds: Rect); 
  81.     procedure SetPrintArea (window: WindowRef; var bounds: Rect);
  82.     function     SAGetEditField (wind:WindowRef;editID:integer): EditFieldItemRecHandle;
  83.     procedure SASetFocus (theWindow: WindowRef; efrh:EditFieldItemRecHandle);
  84.  
  85.  
  86.     function GetTEString (editFieldID: longint; var s: Str255): integer;
  87.     function AddStringToList (listID: ListRef; var s: Str255): OSErr;
  88.  
  89.     procedure BlastString (h, v: integer; s: Str255); {These will blast text at the location specified. It erases as it draws}
  90.     procedure BlastText (h, v: integer; text: Handle);
  91.     procedure SetMyTitle (title: Str255);
  92.     
  93.     procedure SADisableMe;
  94.     procedure SAEnableMe;
  95.     procedure SADisableObject(thing:longint);
  96.     procedure SAEnableObject(thing:longint);
  97.  
  98.     function     SAGetGroupItem(wind:WindowRef;groupID:integer;item:integer):ButtonItemRecHandle;
  99.     function     SADrawObject(orh:ObjectRef;update:RgnHandle):integer;
  100.  
  101.     function     SAPPCBrowser(var theLocationNameRec: LocationNameRec; var thePortInfoRec: PortInfoRec): OSErr;
  102.     function     SAPPCStart(thePortInfoPtr: PortInfoPtr; theLocationNamePtr: LocationNamePtr;thePortRefNum: PPCPortRefNum; VAR theSessRefNum: PPCSessRefNum;VAR theUserRefNum: LongInt; VAR theRejectInfo: LongInt): OSErr;
  103.     function     SAPPCOpen(VAR thePortRefNum: PPCPortRefNum;var thePPCPortRec:    PPCPortRec; var theLocationNameRec: LocationNameRec; var nbpRegisteredFlag: Boolean): OSErr;
  104.     
  105.     function InstallCustomObject (var objectID: longint;
  106.                                 window: WindowRef;
  107.                                 var name: Str255;
  108.                                 var r: Rect;
  109.                                 cmdKey: UInt8;
  110.                                 oip: ObjectInitProc;
  111.                                 odp: ObjectDisposeProc;
  112.                                 ohp: ObjectHitProc;
  113.                                 otp: ObjectTrackProc;
  114.                                 oup: ObjectUpdateProc;
  115.                                 refCon:longint):integer;
  116.                                 
  117. function InstallControl (var buttonID: longint;window: WindowRef;var name: Str255;var  r: Rect;cmdKey: UInt8;controlType:integer; bhp: ButtonHitProc;bup: ButtonUpdateProc): integer;
  118.  
  119. function InstallRadioGroup (var theGroupID: longint;
  120.                                 window: WindowRef;
  121.                                 count:integer; 
  122.                                 var title:Str255;
  123.                                 names:StringArrayPtr; 
  124.                                 var r: Rect; 
  125.                                 defaultItem:integer;
  126.                                 hSpacing:integer ;
  127.                                 vSpacing:integer ;
  128.                                 buttonHeight:integer;
  129.                                 buttonWidth:integer;
  130.                                 PreGHP: PreGroupHitProc; 
  131.                                 PostGHP: PostGroupHitProc; 
  132.                                 gup: GroupUpdateProc): integer;
  133.                                 
  134. function InstallStaticText(var textID:longint; window: WindowRef;
  135.                                                 var text: Str255;    var r: Rect):integer;
  136.     
  137. function     InstallScrollBar (var buttonID: longint; window: WindowRef; var name: Str255; var  r: Rect; cmdKey: UInt8; scrollHitProc: MyActionProc; scrollButtonProc: MyActionProc; scrollIndicatorProc: MyActionProc): integer;
  138. function     ValidWindow (w: WindowRef; var wirh: WindowItemRecHandle): boolean;
  139. procedure SetIdleProc (ep: EventProcs);
  140. function     SASetObjectIdleProc(orh:ObjectRef;idle:ObjectIdleProc):integer;
  141. procedure InstallPreEventHandler (eventHandler:PreEventProc;refCon:longint);
  142. procedure InstallObjectEditProcs (newEditProc:ObjectEditProc;owner:ObjectRef);
  143. function     SAGetObjectHandle(thing:longint):Handle;
  144.     procedure SetWindowHitProc (window:WindowRef;theProc: WindowHitProc);
  145.     procedure SetWindowUpdateProc (window:WindowRef;theProc: WindowUpdateProc);
  146.     procedure SetWindowIdleProc (window:WindowRef;theProc: WindowIdleProc);
  147.     procedure SetWindowGrowProc (window:WindowRef;theProc: WindowGrowProc);
  148.     procedure SetWindowActivateProc (window:WindowRef;theProc: WindowActivateProc);
  149.     procedure SetWindowCloseProc (window:WindowRef;theProc:WindowCloseProc);
  150.     function  GetWindowCloseProc (window:WindowRef):WindowCloseProc;
  151.     procedure SetWindowZoomProc (window:WindowRef;theProc:WindowZoomProc);
  152.     procedure SetWindowFSSpec (window:WindowRef;var theFSSpec: FSSpec);
  153.     function GetWindowFSSpec (window:WindowRef;var theFSSpec: FSSpec):OSErr;
  154. function  SASetSleepValue(sleep:integer):integer;
  155.     function SAFindObject (pt: Point; w: WindowRef): ObjectRef;
  156.     function InstallFontMenu(menuID:SInt16;var name:Str255;menuHit:MenuHitProc;menuUpdate:MenuUpdateProc):SInt16;
  157. procedure SASetStaticText(me:ObjectRef;text:Str255;update:Boolean);
  158. function SABeginFullScreen(var port:GrafPtr;backgroundColor:RGBColor):integer;
  159. function SAEndFullScreen(port:GrafPtr):integer;
  160.  
  161.     function InstallMenu (menuID: integer;
  162.                                     var menuTitle: Str255;
  163.                                     Hierarchical:Boolean;
  164.                                     menuHit: MenuHitProc;
  165.                                     menuUpdate: MenuUpdateProc): integer;
  166.     function InstallResourceMenu (menuID: integer;
  167.                                                 var menuTitle: Str255;
  168.                                                 resourceType:OSType;
  169.                                                 afterItem:integer;
  170.                                                 menuHit: MenuHitProc;
  171.                                                 menuUpdate: MenuUpdateProc): integer;
  172.     procedure SAHideMenuBar;
  173.     procedure SARestoreMenuBar;
  174.     procedure _menuBarInit;
  175. function    SAInitBigArray:integer;
  176. function     SAGetDynamicArrayHandle(var theArray:ArrayListPtr):Handle;
  177. procedure SAGiveTime (suggestedTime: integer);
  178.  
  179. implementation
  180.  
  181. end.
  182.  
  183.